Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Q is empty.


QTRS
  ↳ DirectTerminationProof

Q restricted rewrite system:
The TRS R consists of the following rules:

flatten(nil) → nil
flatten(unit(x)) → flatten(x)
flatten(++(x, y)) → ++(flatten(x), flatten(y))
flatten(++(unit(x), y)) → ++(flatten(x), flatten(y))
flatten(flatten(x)) → flatten(x)
rev(nil) → nil
rev(unit(x)) → unit(x)
rev(++(x, y)) → ++(rev(y), rev(x))
rev(rev(x)) → x
++(x, nil) → x
++(nil, y) → y
++(++(x, y), z) → ++(x, ++(y, z))

Q is empty.

We use [23] with the following order to prove termination.

Recursive path order with status [2].
Precedence:
flatten1 > ++2
rev1 > nil
rev1 > unit1
rev1 > ++2

Status:
++2: [1,2]
unit1: multiset
rev1: [1]
nil: multiset
flatten1: multiset